package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-11-14
 * Time: 11:55
 */
//简单易懂，但是超出运行时间！

public class Solution {
    public int iceBreakingGame(int num, int target) {
        int i = 0,k = 0,count = 0;
        int[] arr = new int[num];
        while (count != num-1) {
            if (arr[i] == 0) {
                k++;
                if (k == target) {
                    arr[i] = 1;
                    count++;
                    k=0;
                }
            }
            i++;
            if (i > num-1) {
                i = 0;
            }
        }
        int ans = 0;
        for (int j = 0; j < arr.length; j++) {
            if (arr[j] == 0) {
                ans =  j;
                break;
            }
        }
        return ans;
    }
}
